package com.wyz.demo04;

import com.wyz.demo02.UserService;
import com.wyz.demo02.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        //1.真实角色，必须有
        UserServiceImpl service = new UserServiceImpl();
        //2.代理角色我们new
        ProxyInvocationHandler pih = new ProxyInvocationHandler();
        pih.setObject(service); //处理要代理的接口
        //3.动态生成代理类
        UserService proxy = (UserService) pih.getProxy();
        proxy.addUser();
    }
}
